package com.tencent.wework;

import com.sun.jna.Library;
import com.sun.jna.Native;
import com.sun.jna.Structure;
import com.sun.jna.ptr.PointerByReference;

import java.util.Arrays;
import java.util.List;

public interface Finance extends Library {

	public static class Slice_t extends Structure {
		public String buf;
		public int len;

		public static class ByReference extends Slice_t implements Structure.ByReference {}
		public static class ByValue extends Slice_t implements Structure.ByValue {}

		@Override
		protected List getFieldOrder() {
			return Arrays.asList(new String[]{"buf","len"});
		}
	}

	Finance INSTANCE = Native.load("WeWorkFinanceSdk", Finance.class);

	long NewSdk();

	int Init(long sdk, String corpid, String secret);


	int GetChatData(long sdk, long seq, long limit, String proxy, String passwd, long timeout, Slice_t chatData);


	int DecryptData(String encrypt_key, String encrypt_msg, Slice_t msg);

	void DestroySdk(long sdk);

	Slice_t NewSlice();

	void FreeSlice(Slice_t slice);

	String GetContentFromSlice(Slice_t slice);
}
